package 笔试;

public class aaaa {
    private int find_min(int[] nums,int k){
        int res=Integer.MAX_VALUE;
        for (int i = 0; i <=k; i++) {
            int min_value=nums[i];
            for (int j = i+1; j <nums.length ; j++) {
                min_value=Math.min(min_value,nums[j]);
                if (j>=k)
                    res=Math.min(res,(j-i+1)*min_value);
            }

        }
        return res;
    }
    
    
    
    public static void main(String arg[]){//main--来自高金磊
    
        int a=new aaaa().find_min(new int[]{1,2,1,8,5,6,7,8},4);
        System.out.println(a);
    }
}
